<?php

declare(strict_types=1);

namespace App\CustHub\Model;

use Mine\MineModel;

/**
 * @property int $id 
 * @property int $scheme_id 
 * @property int $robot_id 机器人ID
 * @property int $scheme_type 0=关键词拉群 1=标签拉群 2=批量群邀请
 * @property string $room_wxid 机器人微信ID
 * @property array $genders 性别
 * @property int $sort 排序
 * @property int $status 状态：0=进粉中 1=递补中 2=已满
 * @property int $is_substitute 是否需要替补：0=否 1=是
 * @property \Carbon\Carbon $created_at 
 * @property \Carbon\Carbon $updated_at 
 * @property-read null|ChRobot $robot 
 * @property-read null|ChRoom $room 
 */
class ChRoomInviteActiveRoom extends MineModel
{
    /**
     * The table associated with the model.
     */
    protected ?string $table = 'ch_room_invite_active_room';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['id', 'scheme_id', 'robot_id', 'scheme_type', 'room_wxid', 'genders', 'sort', 'status', 'is_substitute', 'created_at', 'updated_at'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'scheme_id' => 'integer', 'robot_id' => 'integer', 'scheme_type' => 'integer', 'genders' => 'array', 'sort' => 'integer', 'status' => 'integer', 'is_substitute' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];

    public function robot(): \Hyperf\Database\Model\Relations\HasOne
    {
        return $this->hasOne(ChRobot::class, 'id', 'robot_id');
    }

    public function room(): \Hyperf\Database\Model\Relations\HasOne
    {
        return $this->hasOne(ChRoom::class, 'room_wxid', 'room_wxid');
    }
}
